<template>
  <el-form class="right-event-judge-right-wrong">
    <el-divider content-position="center">获取通用</el-divider>
    <dropdown-normal v-model="wbData.ele_key" :valLists="GENERAL_TYPES" label="通用接口类型" :bIsBtn="false" @change="onUpdateWbComponent" ></dropdown-normal>
    <input-normal label="关联触发组件id" v-model="wbData.relateCompId" @change="onUpdateWbComponent"></input-normal>
    <template v-if="componentData.cid != COMPONENT_TYPES.wb_calendar">
      <el-button type="primary" class="margin-left-right-16 margin-bottom-10" @click.stop="onAddWbItem"><el-icon><i class="jy-icon-plus"></i></el-icon>添加数据项</el-button>
    </template>
    <el-collapse v-model="activeNames">
      <el-collapse-item v-for="(item, index) in eventWbLists" :key="'drag_' + index" :name="index+1" class="list-group-item">
        <template #title>
          数据项{{DIGIT_MAP[index]}}<i class="jy-icon-delete el-collapse-item__arrow" @click.stop="onDeleteWbItem($event, index)"></i>
        </template>
        <template v-if="componentData.cid != COMPONENT_TYPES.wb_calendar">
          <input-normal label="uid" v-model="item.uid" @change="onUpdateWbItem(index)"></input-normal>
        </template>
      </el-collapse-item>
    </el-collapse>
  </el-form>
</template>

<script>
import InputNormal from '@/views/components/edit/InputNormal.vue'
import DropdownNormal from '@/views/components/edit/DropdownNormal.vue'

import { DIGIT_MAP } from '@/common/const'
import { GENERAL_TYPES, GENERAL_TYPES_MAP } from '@/common/const-general'
import { COMPONENT_TYPES } from '@/common/const-wb'
import { addUtils } from "@/views/js/add-utils"

  export default {
    mixins: [addUtils],
    setup () {
      return {
        DIGIT_MAP: DIGIT_MAP,
        GENERAL_TYPES: GENERAL_TYPES,
        GENERAL_TYPES_MAP: GENERAL_TYPES_MAP,
        COMPONENT_TYPES: COMPONENT_TYPES
      }
    },
    components: {
      InputNormal,
      DropdownNormal,
    },
  }
</script>
